<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="renderer" content="webkit|ie-comp|ie-stand" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title></title>
<%@ include file="/mete.jsp"%>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-1.8.2.min.js"></script>
<script type='text/javascript' src='${pageContext.request.contextPath }/js/validator/validator.js' ></script>
<script type="text/javascript">
	$(function(){
		$("#price_type").change(function(){
			onChange();
		});
		
		$("#price_type").val("${model.PRICE_TYPE}");
		$("#note").val("${model.NOTE}");
		
		onChange();
		
		$("#frmApp").validator({
			rules: {},
			fields: {
			    "#price": "required",
			    "#price_type": "required",
			},
			valid: function (form) {
				$.post(form.submit(),null,function(resq){
					var json = eval('('+resq+')');
					if(json.status == 0)
						alert(json.data);
				})
			},
			dataType:"json"
			});
	})
	
	function onChange(){
	console.log("on change......");
	if($("#price_type").val() == 0){
		$("#price").attr("name","PRICE");
		$("#price").val("${model.PRICE }");
	}else if($("#price_type").val() == 1){
		$("#price").attr("name","PRICE1");
		$("#price").val("${model.PRICE1 }");
	}else{
		console.log("null......");
		$("#price").attr("name","");
		$("#price").val("");
	}
}
</script>
</head>
<body>
	<div class="meijieContent">
		<div class="myform app_info">
		<form action="${pageContext.request.contextPath }/competitive!update.do" class="form-horizontal n-validator n-yellow" id="frmApp" method="post" role="form">
			<h2>新增网点</h2>
			<ul>
			<input type="hidden" name="ID" value="${model.ID }">
            <table>
               
               <tr class="trbg">
                    <td class="colname"><span class="warn">*</span>价格类型:</td>
                    <td class="content">
                    	<select id="price_type" name="PRICE_TYPE" >
                    		<option value="">--请--选--择--</option>
                    		<option value="0">按百分比</option>
                    		<option value="1">比市价便宜</option>
						</select>
					</td>
               </tr>
               <tr class="trbg">
                    <td class="colname"><span class="warn">*</span>价格:</td>
                    <td class="content"><input class="txt" id="price" placeholder="请输入价格" type="text"/></td>
               </tr>
               <tr class="trbg">
                    <td class="colname"><span class="warn">*</span>竞标说明:</td>
                    <td class="content"><textarea rows="3" cols="31" id="note" name="NOTE" value="${model.NOTE }"></textarea></td>
               </tr>
				<tr class="trbg">
                    <td class="submit" colspan="2" align="center">
                    	<input class="submit" type="submit" value="保  存"/>
					</td>
               </tr>
            </table>
		</ul>
	</form>
	</div>
	</div>
</body>

</html>
